import re


class StringUtil:
    @staticmethod
    def edit_distance(s1: str, s2: str):
        n1 = len(s1)
        n2 = len(s2)
        dp = [[0 for _ in range(n2 + 1)] for _ in range(n1 + 1)]
        for i in range(n1 + 1):
            dp[i][0] = i
        for j in range(n2 + 1):
            dp[0][j] = j

        for i in range(1, n1 + 1):
            for j in range(1, n2 + 1):
                dp[i][j] = min(dp[i - 1][j] + 1, dp[i][j - 1] + 1,
                               dp[i - 1][j - 1] + (2 if s1[i - 1] != s2[j - 1] else 0))
        return dp[n1][n2] / n1

    @staticmethod
    def isNullStr(*args: str) -> bool:
        if args is None or len(args) == 0:
            return True
        for arg in args:
            if arg is None or arg.strip() == "":
                return True
        return False

    @staticmethod
    def check_filter(text: str) -> str:
        return re.sub(keywords, "***", text)


keywords = ("主席")

if __name__ == '__main__':
    s1 = '考试计算机学科委员会的主席'
    print(StringUtil.check_filter(s1))
